package main

import (
	"github.com/gin-gonic/gin"
	"uniquen.top/golang-demo/controller"
	"uniquen.top/golang-demo/middleware"
)

func CollectRoute(r *gin.Engine) *gin.Engine {

	r.Use(middleware.RecoveryMiddleware())

	r.POST("/api/auth/register", controller.Register)
	r.GET("/api/auth/login", controller.Login)
	r.GET("/api/auth/info", middleware.AuthMiddleWare(), controller.Info)

	category := r.Group("/category")
	categoryController := controller.NewCategoryController()

	category.POST("", categoryController.Create)
	category.PUT("/:id", categoryController.Update)
	category.GET("/:id", categoryController.Show)
	category.DELETE("/:id", categoryController.Delete)

	return r
}
